<?php
    $name = "";
    $birthdate ="";
    $gender = "";
    $address = "";
    $country ="";
    $favorite = "";
    $job = "";
    $company ="";
    $website ="";
    $more = "";
    $yahoo ="";
    $cmnd= "";
    if(!empty($profile)){
        $name = $profile->name;
        $birthdate = $profile->birthdate;
        $gender = $profile->gender;
        $address = $profile->address;
        $country = $profile->country;
        $favorite = $profile->favorite;
        $job = $profile->job;
        $company = $profile->company;
        $website = $profile->website;
        $more = $profile->more;
        $yahoo =$profile->yahoo;
        $cmnd = $profile->cmnd;
    }
    global $site_info;
    
?>
<div class="main" style="clear:both;margin-top:30px;">
<!-- Container-->
<?php
$payment_method = array(1=>'Trực tuyến',2=>'Ngân hàng',3=>'Tại nhà');
$shipping_method = array(1=>'Phát nhanh',2=>'Phát thường',3=>'Tại Cty',4=>'60 phút');
$payment_status = array(1=>'Đã thanh toán',2=>'Tạm giữ',0=>'Chưa thanh toán');
$order_status = array(0=>'Chưa xử lý',1=>'Đang xử lý',2=>'Đang chuyển hàng',3=>'Hoàn tất',4=>'Hủy bỏ');
if(!$site_info['register'])
        echo '<h1 align=center class=title>Cannot register at now...</h1>';
    else{?>
<?php echo $this->session->flashdata('_message'); ?>

<?php echo form_open('index/account/update',array('id'=>'login_box','class'=>'profile')) ?>

  <div class="cat-title modal-header"  style="cursor: pointer;">
    <h2 style="text-transform: capitalize;"><?php echo $this->lang->line('profile_title') ?></h2>
  </div>
  <div class="ct">
  <table width="100%">
    
    <tr>
        <td width="20%"><label for="name"><?php echo $this->lang->line('fullname') ?></label></td>
        <td><input type="text" name="name" disabled="" style="background: #fff;border: 1px solid #ccc;" id="name" value="<?php echo $name?>" /></td>
    </tr>
    <tr>
        <td><label for="birthdate"><?php echo $this->lang->line('birthdate') ?></label></td>
        <td><input type="text" name="birthdate" disabled="" style="background: #fff;border: 1px solid #ccc;" id="birthdate" value="<?php echo $birthdate?>"/></td>
    </tr>
    <tr>
        <td><label for="gender"><?php echo $this->lang->line('gender') ?></label></td>
        <td><select name="gender" id="gender" disabled="" style="background: #fff;border: 1px solid #ccc;">
        <option value="0" <?php echo $gender==0?"selected='selected'":"";?>><?php echo $this->lang->line('male') ?></option>
        <option value="1" <?php echo $gender==1?"selected='selected'":"";?>><?php echo $this->lang->line('female') ?></option>
    </select></td>
    </tr>
    <tr>
        <td><label for="address"><?php echo $this->lang->line('address') ?></label></td>
        <td><input type="text" disabled="" style="background: #fff;border: 1px solid #ccc;" name="address" id="address" value="<?php echo $address?>" /></td>
    </tr>
    <tr>
        <td><label for="country"><?php echo $this->lang->line('country') ?></label></td>
        <td><input type="text" disabled="" style="background: #fff;border: 1px solid #ccc;" name="country" id="country" value="<?php echo $country?>"/></td>
    </tr>
    <tr>
        <td><label for="favorite"><?php echo $this->lang->line('favorite') ?></label></td>
        <td><input type="text" name="favorite" disabled="" style="background: #fff;border: 1px solid #ccc;" id="favorite" value="<?php echo $favorite?>" /></td>
    </tr>
    <tr>
        <td> <label for="job"><?php echo $this->lang->line('job') ?></label></td>
        <td><input type="text" name="job" id="job" disabled="" style="background: #fff;border: 1px solid #ccc;" value="<?php echo $job?>" /></td>
    </tr>
    <tr>
        <td><label for="company"><?php echo $this->lang->line('company') ?></label></td>
        <td><input type="text" name="company" disabled="" style="background: #fff;border: 1px solid #ccc;" id="company" value="<?php echo $company?>" /></td>
    </tr>
    <tr>
        <td><label for="website"><?php echo $this->lang->line('website') ?></label></td>
        <td><input type="text" name="website" disabled="" style="background: #fff;border: 1px solid #ccc;" id="website" value="<?php echo $website?>" /></td>
    </tr>
    <tr>
        <td style="vertical-align: top;"><label for="more"><?php echo $this->lang->line('more') ?></label></td>
        <td> <textarea name="more" id="more" disabled="" cols="50" rows="5" style="background: #fff;border: 1px solid #ccc;" style="width: 400px; height: 100px;" class="ckeditor" class="large"><?php echo $more?></textarea></td>
    </tr>
    <tr>
        <td><label for="website">Yahoo Messenger</label></td>
        <td><input type="text" name="yahoo" disabled="" style="background: #fff;border: 1px solid #ccc;" id="yahoo" value="<?php echo $yahoo?>" /></td>
    </tr>
    <tr>
        <td style="vertical-align: top;"><label for="more">CMND</label></td>
        <td><input type="text" name="cmnd" disabled="" style="background: #fff;border: 1px solid #ccc;" id="cmnd" value="<?php echo $cmnd?>" /></td>
    </tr>
    <tr>
    <td></td>
        <td>
             <p id="change_profile"><a href="javascript:;"><strong>Thay đổi thông tin</strong></a></p><input type="submit" class="login_button" style="display: none;"  value="Cập nhật"/>
        </td>
    </tr>
  </table></div>
  </div>
</form><?php } ?>
<div  class="orderlist main " style="margin-top: 15px;">
<div class="" id="myModal" >
  <div class="cat-title modal-header"  style="cursor: pointer;">
    <h2 style="text-transform: capitalize;"><?php echo $this->lang->line('order_title') ?></h2>
  </div>
  <div class="ct">
  <table width="100%">
  <tr>
    <td style="padding: 5px 0;font-weight: bold;"><b>#</b></td>
    <td  style="padding: 5px 0;font-weight: bold;"><b>Ngày đặt hàng</b></td>
    <td style="padding: 5px 0;font-weight: bold;"><b>Tình trạng</b></td>
    <td style="text-align: right;font-weight: bold;"><b>Chi tiết đơn hàng</b></td>
  </tr>
    <?php
    if(!empty($orders)){
        $total = 0;
        foreach($orders as $order){
            
    ?>
    <tr>
        <td><?php echo $order->order_id ?></td>
        <td><?php echo mdate('%d/%m/%Y',$order->created_at)?></td>
        <td><p><?php echo $order_status[$order->status]?></p>
        <p><?php echo $order->reason_cancel?></p>
        </td>
        <td style="text-align: right;"><a class="order_detail" id="<?php echo $order->order_id ?>" href="javascript:;">Hiện chi tiết</a>/<a class="order_detail_hide" id="<?php echo $order->order_id ?>" href="javascript:;">Ẩn chi tiết</a></td>
    </tr>
    
    <tr>
      <td colspan="4"><div style="display: none;" class="order_detail_<?php echo $order->order_id ?>">
        <table width="100%">
        <tr>
            <td colspan="6"><h3>Chi tiết đơn hàng</h3></td>
        </tr>
         <?php 
    $order_detail = $this->_global->_unserialize($order->order_details);
        foreach($order_detail as $dt){
            $total +=$dt['subtotal']; 
    ?> 
        <tr>
        <td style="vertical-align: middle;"><?php echo $dt['id'] ?></td>
        <td style="vertical-align: middle;"><?php echo anchor($dt['options']['link'],$dt['name']) ?></td>
        <td style="vertical-align: middle;"><?php echo $dt['qty'] ?></td>
        <td style="vertical-align: middle;"><?php echo 'Size :'. $dt['options']['Size'].' Color:'.$dt['options']['Color'] ?></td>
        <td style="vertical-align: middle;"><img src="<?php echo $this->config->item('cdn_url').'exec/timthumb.php?src='.base_url()._get_image_product($dt['id'],$dt['options']['Color']).'&w=150' ?>"/></td>
        <td style="vertical-align: middle;"><?php echo $dt['subtotal'].' '.$order->currency_code ?></td>
    </tr>
    <tr>
        <td colspan="6" style="text-align: right;"><h3>Tổng cộng:<?php echo $total.' '.$order->currency_code ?></h3></td>
    </tr>
    <?php        
        }
    ?> 
        </table></div>
      </td>  
    </tr>
    
    
    <?php
        }
    }else{
        echo '<p>Chưa có đơn hàng nào</p>';
    }
     ?></table>
  </div>
  </div>
  </div>
  
  
<div class="clear"></div>
<!--End Contaier--> 